package com.bjpowernode.controller;

import com.bjpowernode.entity.TClueRemark;
import com.bjpowernode.query.ActivityRemarkQuery;
import com.bjpowernode.query.ClueRemarkQuery;
import com.bjpowernode.result.Result;
import com.bjpowernode.service.ClueRemarkService;
import com.github.pagehelper.PageInfo;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

@RestController
@RequiredArgsConstructor
public class ClueRemarkController {

    private final ClueRemarkService clueRemarkService;

    @PostMapping("/api/clue/remark")
    public Result saveClueRemark(@RequestBody ClueRemarkQuery clueRemarkQuery) {
       int result =  clueRemarkService.saveClueRemark(clueRemarkQuery);

       return result > 0 ? Result.OK() : Result.FAIL();
    }

    /**
     * 分页查询
     */
    @GetMapping("/api/clue/{clueId}/remark")
    public Result getClueRemarkByPage(@PathVariable Integer clueId,Integer current) {
        PageInfo<TClueRemark> pageInfo =  clueRemarkService.selectByPage(clueId, current);
        return Result.OK(pageInfo);
    }
}
